<?php
header('content-type:text/html;charset=utf-8');
// 身份验证
session_start();

include_once('dbtools.inc.php');
include_once('config.php');
// error_reporting(5);
// error_reporting(E_ALL & ~E_NOTICE);
// error_reporting(0);

if(!isset($_SESSION['login'])){
	header('Refresh:2;url=login/index.php');
	echo '用户还没登录!';
	die();
}
// 接收数据
$id=isset($_GET['id'])?$_GET['id']:0;

// 组织删除
// 引入数据库
// require 'config.php';
// $email=$_SESSION['login'];
// $query_email="SELECT * FROM users WHERE `uemail`='$email'";
// $result_email=mysqli_query($config,$query_email);
// $row_email=mysqli_fetch_array($result_email);
// // echo $row_email['uemail'];
// $user_email=$row_email['userid'];
// // var_dump($row_email);
// $gds="SELECT * FROM goods WHERE `userid`='$user_email'";
// // $goods="SELECT * FROM goods ORDER BY goodsid DESC";
// 			$resultgoods=mysqli_query($config,$gds) or die ('SQL语句有误:'.mysql_error());

// $sql="select * from goods";

$link=create_connection();
$sql="delete from goods where goodsid={$id}";
$res=execute_sql($link,'school',$sql);
// header('Refresh:1;url=index.php');
// echo '移除成功！';
// var_dump($sql);
echo ('<script type="text/javascript">alert("删除成功！");
     			window.history.back(-1);
     			</script>');
	die();


?>